package com.ecut.xzh.mapper;

import com.ecut.xzh.entity.VoucherOrder;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

/**
 * @author XZH
 */
@Mapper
public interface VoucherOrderMapper {

    /**
     * 插入优惠券订单
     * @param voucherOrder
     */
    @Insert("insert into voucher_order (id,student_id,voucher_id) values (#{id},#{studentId},#{voucherId})")
    void insert(VoucherOrder voucherOrder);

    /**
     * 查询用户购买的某张优惠券数量
     * @param voucherOrder
     * @return
     */
    @Select("select count(*) from voucher_order where student_id = #{studentId} and voucher_id = #{voucherId}")
    int count(VoucherOrder voucherOrder);
}
